package com.bm.greeting.controller;

import com.bm.greeting.config.JiNianRiUtils;
import com.bm.greeting.config.ToolsUtils;
import com.bm.greeting.entity.Weather;
import com.bm.greeting.service.impl.SendMail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/email")
public class EmailController {

    @Autowired
    private SendMail sendMail;

    @GetMapping("/test")
    public void sendMail() {
        String data = "";
        Weather weather = ToolsUtils.getWeather();
        Map<String, String> yiTyjmap = ToolsUtils.getEnsentence();
        Map<String, String> qingShiMap = ToolsUtils.getQingShi();
        data += "<br>";
        data += "<font  color='#00BFFF'> " + weather.getDate() + "" + weather.getWeek() + " </font>";
        data += "<br>";
        data += "<font  color='#00FFFF'> 天气：" + weather.getText_now() + " </font>";
        data += "<br>";
        data += "<font  color='#EE212D'> 当前温度:" + weather.getTemp() + " </font>";
        data += "<br>";
        data += "<font  color='#173177'> 最低温度:" + weather.getLow() + " </font>";
        data += "<br>";
        data += "<font  color='#FF6347'> 最高温度:" + weather.getHigh() + " </font>";
        data += "<br>";
        data += "<font  color='#42B857'> 风级:" + weather.getWind_class() + " </font>";
        data += "<br>";
        data += "<font  color='#B95EA3'> 风向:" + weather.getWind_dir() + " </font>";

        data += "<br>";
        data += "<font  color='#FF69B4'> " + ToolsUtils.getCaiHongPi() + " </font>";
        data += "<br>";
        data += "<font  color='#FF1493'> 今天是我们恋爱的第" + JiNianRiUtils.getLianAi() + "天 </font>";

        data += "<br>";
        data += "<font  color='#FFA500'> 你老公大人的生日倒计时提醒：" + JiNianRiUtils.getBirthday_Jimmy() + " </font>";

        data += "<br>";
        data += "<font  color='#FFA500'> 小可爱的生日倒计时提醒：" + JiNianRiUtils.getBirthday_xy() + " </font>";

        data += "<br>";
        data += "<font  color='#C71585'> " + yiTyjmap.get("en") + " </font>";
        data += "<br>";
        data += "<font  color='#C71585'> " + yiTyjmap.get("zh") + " </font>";
        data += "<br>";
        data += "<font  color='#F03752'> " + ToolsUtils.getTheTrickOfLife() + " </font>";

        data += "<br>";
        data += "<font  color='#158BB8'> " + qingShiMap.get("content") + "<<" + qingShiMap.get("source") + ">> " + qingShiMap.get("author") + " </font>";
        data += "<br>";
        data += "<font  color='#DE3F7C'> " + ToolsUtils.getGoodMorning() + " </font>";
        sendMail.sendMessage("小可爱的日常信息", data, "694372334@qq.com");
    }

}
